<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/jquery-3.3.1.min.js"></script>
    <script>
        $(function() {
            // var targetObj = {};
            // var obj = {
            //         id: 1,
            //         name: "andy"
            //     }
            //     //$.extend(target,obj);
            // $.extend(targetObj, obj);
            // console.log(targetObj);
            var targetObj = {
                id: 0,
                add: 1,
                msg: {
                    sex: '男'
                }
            };
            var obj = {
                    id: 1,
                    name: "andy",
                    msg: {
                        age: 19
                    }
                }
                //$.extend(target,obj);
                //$.extend( targetObj, obj);
            $.extend(true, targetObj, obj);
            console.log(targetObj);
            targetObj.msg.age = 100;
            console.log(obj.msg.age);
        })
    </script>
</head>

<body>

</body>

</html>